﻿using System;

namespace Core
{
    /// <summary>
    /// 销毁会取消属性的buff
    /// </summary>
    [Buff]
    public class AttributeBuff : BuffSystem
    {
        private int valueName;
        private long value;
        protected override void OnAwake()
        {
            int.TryParse(config.param1, out valueName);
            long.TryParse(config.param2, out value);
            target.GetComponent<NumericComponent>()[valueName] += value;
        }

        protected override void OnDispose()
        {
            target.GetComponent<NumericComponent>()[valueName] -= value;
        }
    }
}